home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 April: Mac OS SDK / Dev.CD Apr 96 SDK / Dev.CD Apr 96 SDK1.toast / Development Kits (Disc 1) / OpenDoc Development Framework / ODFDev / ODF / Examples / Draw / Sources / BaseShp.cpp < prev    next >
Encoding:
Text File  |  1995-11-08  |  20.2 KB  |  714 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                BaseShp.cpp
  4. //    Release Version:    $ 1.0d11 $
  5. //
  6. //    Author:                Henri Lamiraux
  7. //
  8. //    Copyright:    © 1993, 1995 by Apple Computer, Inc., all rights reserved.
  9. //
  10. //========================================================================================
  11.  
  12. #include "ODFDraw.hpp"
  13.  
  14. #ifndef BASESHP_H
  15. #include "BaseShp.h"
  16. #endif
  17.  
  18. #ifndef UTILS_H
  19. #include "Utils.h"
  20. #endif
  21.  
  22. #ifndef CONSTANT_H
  23. #include "Constant.h"
  24. #endif
  25.  
  26. #ifndef DRAWPART_H
  27. #include "DrawPart.h"
  28. #endif
  29.  
  30. #ifndef DRAWPART_H
  31. #include "DrawPart.h"
  32. #endif
  33.  
  34. #ifndef DRAWFRM_H
  35. #include "DrawFrm.h"
  36. #endif
  37.  
  38. #ifndef DRAWPRXY_H
  39. #include "DrawPrxy.h"
  40. #endif
  41.  
  42. #ifndef DRAWLINK_H
  43. #include "DrawLink.h"
  44. #endif
  45.  
  46. #ifndef DRAWCLIP_H
  47. #include "DrawClip.h"
  48. #endif
  49.  
  50. // ----- Part Layer -----
  51.  
  52. #ifndef FWFRMING_H
  53. #include "FWFrming.h"
  54. #endif
  55.  
  56. #ifndef FWUTIL_H
  57. #include "FWUtil.h"
  58. #endif
  59.  
  60. #ifndef FWSELECT_H
  61. #include "FWSelect.h"
  62. #endif
  63.  
  64. #ifndef FWITERS_H
  65. #include "FWIters.h"
  66. #endif
  67.  
  68. // ----- OS Layer -----
  69.  
  70. #ifndef FWEVENT_H
  71. #include "FWEvent.h"
  72. #endif
  73.  
  74. #ifndef FWRECSHP_H
  75. #include "FWRecShp.h"
  76. #endif
  77.  
  78. #ifndef FWTXTBOX_H
  79. #include "FWTxtBox.h"
  80. #endif
  81.  
  82. #ifndef FWLINSHP_H
  83. #include "FWLinShp.h"
  84. #endif
  85.  
  86. #ifndef FWOVLSHP_H
  87. #include "FWOvlShp.h"
  88. #endif
  89.  
  90. #ifndef FWRRCSHP_H
  91. #include "FWRRcShp.h"
  92. #endif
  93.  
  94. #ifndef FWODGEOM_H
  95. #include "FWODGeom.h"
  96. #endif
  97.  
  98. // ----- Foundation Includes -----
  99.  
  100. #ifndef FWSTREAM_H
  101. #include "FWStream.h"
  102. #endif
  103.  
  104. // ----- OpenDoc Includes -----
  105.  
  106. #ifndef SOM_ODTransform_xh
  107. #include <Trnsform.xh>
  108. #endif
  109.  
  110. //========================================================================================
  111. // Runtime Information
  112. //========================================================================================
  113.  
  114. #ifdef FW_BUILD_MAC
  115. #pragma segment odfdrawshapes
  116. #endif
  117.  
  118. //========================================================================================
  119. // RunTime Info
  120. //========================================================================================
  121.  
  122. FW_DEFINE_CLASS_M0(CBaseShape)
  123.  
  124. FW_REGISTER_ARCHIVABLE_CLASS(LBaseShape, CBaseShape, CBaseShape::Read, CBaseShape::Write)
  125.  
  126. //========================================================================================
  127. // globals
  128. //========================================================================================
  129.  
  130. FW_CRectShape* CBaseShape::gWorkingHandle = NULL;
  131. unsigned long CBaseShape::gShapeCount = 0;
  132.  
  133. // [KVV] Constructing gDefaultStyle and gDefaultInk like this causes
  134. //    problems because of order of initializaiton
  135. // const FW_PStyle gDefaultStyle = FW_kNormalStyle;
  136. // const FW_PInk gDefaultInk = FW_kNormalInk;
  137.  
  138. const FW_EStandardStyles gDefaultStyle = FW_kNormalStyle;
  139. const FW_EStandardInks gDefaultInk = FW_kNormalInk;
  140.  
  141. //========================================================================================
  142. // class CBaseShape
  143. //========================================================================================
  144.  
  145. //----------------------------------------------------------------------------------------
  146. // CBaseShape::CBaseShape
  147. //----------------------------------------------------------------------------------------
  148.  
  149. CBaseShape::CBaseShape(short numberOfHandles, unsigned short shapeType, unsigned short renderVerb) :
  150.     fSelected(FALSE),
  151.     fNumberOfHandles(numberOfHandles),
  152.     fShapeType(shapeType),
  153.     fPublishLink(NULL),
  154.     fSubscribeLink(NULL),
  155.     fRenderVerb(renderVerb),
  156.     fFrameInk(gDefaultInk),
  157.     fFillInk(gDefaultInk),
  158.     fFrameStyle(gDefaultStyle),
  159.     fFillStyle(gDefaultStyle),
  160.     fPromised(0)
  161. {
  162.     InitStatic();
  163. }
  164.  
  165. //----------------------------------------------------------------------------------------
  166. // CBaseShape::CBaseShape
  167. //----------------------------------------------------------------------------------------
  168.  
  169. CBaseShape::CBaseShape(FW_CReadableStream& archive) :
  170.     fPublishLink(NULL),
  171.     fSubscribeLink(NULL),
  172.     fSelected(FALSE),
  173.     fPromised(0)
  174. {
  175.     InitStatic();
  176.     
  177.     archive >> fShapeType;
  178.     archive >> fNumberOfHandles;
  179.         
  180.     archive >> fFrameInk;
  181.     archive >> fFillInk;
  182.     archive >> fFrameStyle;
  183.     archive >> fFillStyle;
  184.  
  185.     archive >> fRenderVerb;
  186. }
  187.  
  188. //----------------------------------------------------------------------------------------
  189. // CBaseShape::InitStatic
  190. //----------------------------------------------------------------------------------------
  191.  
  192. void CBaseShape::InitStatic()
  193. {
  194.     if (gShapeCount == 0)
  195.     {
  196.         CBaseShape::gWorkingHandle = FW_NEW(FW_CRectShape, (FW_kZeroRect, FW_kFill));
  197.         CBaseShape::gWorkingHandle->SetInk(FW_kInvertInk);
  198.     }
  199.     
  200.     CBaseShape::gShapeCount++;
  201. }
  202.  
  203. //----------------------------------------------------------------------------------------
  204. // CBaseShape::~CBaseShape
  205. //----------------------------------------------------------------------------------------
  206.  
  207. CBaseShape::~CBaseShape()
  208. {
  209.     FW_ASSERT(fPromised == 0);
  210.     
  211.     CBaseShape::gShapeCount--;
  212.     if (CBaseShape::gShapeCount == 0)
  213.         delete CBaseShape::gWorkingHandle;
  214. }
  215.  
  216. //----------------------------------------------------------------------------------------
  217. // CBaseShape::Removed
  218. //----------------------------------------------------------------------------------------
  219.  
  220. void CBaseShape::Removed(Environment* ev)
  221. {
  222. }
  223.  
  224. //----------------------------------------------------------------------------------------
  225. // CBaseShape::Deleted
  226. //----------------------------------------------------------------------------------------
  227.  
  228. void CBaseShape::Deleted(Environment* ev)
  229. {
  230. }
  231.  
  232. //----------------------------------------------------------------------------------------
  233. // CBaseShape::CheckPromise
  234. //----------------------------------------------------------------------------------------
  235.  
  236. void CBaseShape::CheckPromise(Environment* ev, FW_CPart* part)
  237. {
  238.     if (fPromised != 0)
  239.         part->ResolveAllPromises(ev);    // I promised only one so...
  240. }
  241.  
  242. //----------------------------------------------------------------------------------------
  243. // CBaseShape::Promised
  244. //----------------------------------------------------------------------------------------
  245.  
  246. void CBaseShape::Promised(FW_EStorageKinds storageKind, FW_Boolean state)
  247. {
  248.     if (state)
  249.     {
  250.         FW_ASSERT((fPromised & storageKind) == 0);
  251.         fPromised |= storageKind;
  252.     }
  253.     else
  254.     {
  255.         FW_ASSERT((fPromised & storageKind) != 0);
  256.         fPromised ^= fPromised & storageKind;
  257.     }
  258. }
  259.  
  260. //----------------------------------------------------------------------------------------
  261. // CBaseShape::TrackFeedback
  262. //----------------------------------------------------------------------------------------
  263.  
  264. void CBaseShape::TrackFeedback(Environment* ev,
  265.                                 ODFacet* facet,
  266.                                 FW_CGraphicContext& gc,
  267.                                 const FW_CPoint& anchorPoint, 
  268.                                 const FW_CPoint& currentPoint, 
  269.                                 FW_Boolean erase)
  270. {
  271.     if (!erase)
  272.         SetShapeGeometry(anchorPoint, currentPoint);
  273.  
  274.     RenderShape(ev, facet, gc);
  275. }
  276.  
  277. //----------------------------------------------------------------------------------------
  278. // CBaseShape::SelectShape
  279. //----------------------------------------------------------------------------------------
  280.  
  281. void CBaseShape::SelectShape(Environment* ev, FW_Boolean state)
  282. {
  283.     fSelected = state;
  284. }
  285.  
  286. //----------------------------------------------------------------------------------------
  287. // CBaseShape::ClearCache
  288. //----------------------------------------------------------------------------------------
  289.  
  290. void CBaseShape::ClearCache()
  291. {
  292. }
  293.  
  294. //----------------------------------------------------------------------------------------
  295. // CBaseShape::RenderHandles
  296. //----------------------------------------------------------------------------------------
  297. //    if asynchFacet is != NULL it means we are drawing asynchronously in a facet
  298.  
  299. void CBaseShape::RenderHandles(FW_CGraphicContext& gc)
  300. {    
  301.     for (short i=1; i<=fNumberOfHandles; i++)
  302.     {
  303.         CalcHandle(i, CBaseShape::gWorkingHandle);    
  304.         CBaseShape::gWorkingHandle->Render(gc);
  305.     }
  306. }
  307.  
  308. //----------------------------------------------------------------------------------------
  309. // CBaseShape::CalcHandle
  310. //----------------------------------------------------------------------------------------
  311.  
  312. void CBaseShape::CalcHandle(short whichHandle, FW_CRectShape* handle) const
  313. {
  314.     FW_CPoint pt;
  315.     GetHandleCenter(whichHandle, pt);
  316.     
  317.     const FW_CFixed fx25 = FW_DoubleToFixed(2.5);
  318.     FW_CRect rect(
  319.         pt.x - fx25, pt.y - fx25, pt.x + fx25, pt.y + fx25);
  320.     
  321.     handle->SetRectangle(rect);
  322. }
  323.  
  324. //----------------------------------------------------------------------------------------
  325. // CBaseShape::InSelectionRect
  326. //----------------------------------------------------------------------------------------
  327.  
  328. FW_Boolean CBaseShape::InSelectionRect(const FW_CRect& selectRect) const
  329. {
  330.     FW_CRect bounds;
  331.     GetRectGeometry(bounds);
  332.     
  333.     FW_CRect temp(bounds);
  334.     temp.Intersection(selectRect);
  335.     
  336.     return bounds == temp;
  337. }
  338.  
  339. //----------------------------------------------------------------------------------------
  340. // CBaseShape::Flatten
  341. //----------------------------------------------------------------------------------------
  342.  
  343. void CBaseShape::Flatten(FW_CWritableStream& archive)
  344. {    
  345.     archive << fShapeType;
  346.     archive << fNumberOfHandles;
  347.     
  348.     archive << fFrameInk;
  349.     archive << fFillInk;
  350.     archive << fFrameStyle;
  351.     archive << fFillStyle;
  352.     
  353.     archive << fRenderVerb;
  354. }
  355.  
  356. //----------------------------------------------------------------------------------------
  357. // CBaseShape::MovedAfter
  358. //----------------------------------------------------------------------------------------
  359.  
  360. void CBaseShape::MovedAfter(Environment* ev, CBaseShape* shape)
  361. {
  362. FW_UNUSED(shape);
  363. }
  364.  
  365. //----------------------------------------------------------------------------------------
  366. // CBaseShape::MovedBefore
  367. //----------------------------------------------------------------------------------------
  368.  
  369. void CBaseShape::MovedBefore(Environment* ev, CBaseShape* shape)
  370. {
  371. FW_UNUSED(shape);
  372. }
  373.  
  374. //----------------------------------------------------------------------------------------
  375. // CBaseShape::MovedFirst
  376. //----------------------------------------------------------------------------------------
  377.  
  378. void CBaseShape::MovedFirst(Environment* ev)
  379. {
  380. }
  381.  
  382. //----------------------------------------------------------------------------------------
  383. // CBaseShape::MovedLast
  384. //----------------------------------------------------------------------------------------
  385.  
  386. void CBaseShape::MovedLast(Environment* ev)
  387. {
  388. }
  389.  
  390. //----------------------------------------------------------------------------------------
  391. // CBaseShape::RestoreShape
  392. //----------------------------------------------------------------------------------------
  393.  
  394. void CBaseShape::RestoreShape(Environment *ev, CDrawPart* drawPart)
  395. {
  396.     drawPart->AddShape(ev, this);
  397. }
  398.  
  399. //----------------------------------------------------------------------------------------
  400. // CBaseShape::SetFrozen
  401. //----------------------------------------------------------------------------------------
  402.  
  403. FW_Boolean CBaseShape::SetFrozen(FW_Boolean state)
  404. {
  405. FW_UNUSED(state);
  406.     return FALSE;    // Means I don't care
  407. }
  408.  
  409. //----------------------------------------------------------------------------------------
  410. // CBaseShape::IsFrozen
  411. //----------------------------------------------------------------------------------------
  412.  
  413. FW_Boolean CBaseShape::IsFrozen() const
  414. {
  415.     return FALSE;
  416. }
  417.  
  418. //----------------------------------------------------------------------------------------
  419. // CBaseShape::GetPenSize
  420. //----------------------------------------------------------------------------------------
  421.  
  422. FW_CFixed CBaseShape::GetPenSize() const
  423. {
  424.     return HasFrameStyle() ? fFrameStyle->GetPenSize() : FW_kFixed0;
  425. }
  426.  
  427. //----------------------------------------------------------------------------------------
  428. // CBaseShape::GetColor
  429. //----------------------------------------------------------------------------------------
  430. void CBaseShape::GetColor(FW_Boolean fill, FW_CColor& color)
  431. {
  432.     if (fill)
  433.         fFillInk->GetForeColor(color);
  434.     else
  435.         fFrameInk->GetForeColor(color);
  436. }
  437.  
  438. //----------------------------------------------------------------------------------------
  439. // CBaseShape::GetPattern
  440. //----------------------------------------------------------------------------------------
  441. FW_PPattern CBaseShape::GetPattern(FW_Boolean fill)
  442. {
  443.     if (fill)
  444.         return fFillStyle->GetPattern();
  445.     else
  446.         return fFrameStyle->GetPattern();
  447. }
  448.  
  449. //----------------------------------------------------------------------------------------
  450. // CBaseShape::UnshareInk
  451. //----------------------------------------------------------------------------------------
  452.  
  453. FW_PInk CBaseShape::UnshareInk(const FW_PInk& ink) const
  454. {
  455. //    Do not use the following syntax. It looks like the life time of temporaries
  456. //    is wrong causing a bad refcounting problem
  457. //    return (ink->GetRefCount() > 1) ? ink->Copy() : ink;
  458.  
  459.     if (ink->GetRefCount() > 1)
  460.         return ink->Copy();
  461.     else
  462.         return ink;
  463. }
  464.  
  465. //----------------------------------------------------------------------------------------
  466. // CBaseShape::UnshareStyle
  467. //----------------------------------------------------------------------------------------
  468.  
  469. FW_PStyle CBaseShape::UnshareStyle(const FW_PStyle& style) const
  470. {
  471. //    Do not use the following syntax. It looks like the life time of temporaries
  472. //    is wrong causing a bad refcounting problem
  473. //    return (style->GetRefCount() > 1) ? style->Copy() : style;
  474.  
  475.     if (style->GetRefCount() > 1)
  476.         return style->Copy();
  477.     else
  478.         return style;
  479. }
  480.  
  481. //----------------------------------------------------------------------------------------
  482. // CBaseShape::ChangeFrameColor
  483. //----------------------------------------------------------------------------------------
  484.  
  485. void CBaseShape::ChangeFrameColor(Environment* ev, CDrawPart* part, const FW_CColor& color)
  486. {
  487.     if (HasFrameStyle())
  488.     {
  489.         CheckPromise(ev, part);
  490.         
  491.         fFrameInk = UnshareInk(fFrameInk);
  492.         fFrameInk->SetForeColor(color);
  493.     }
  494. }
  495.  
  496. //----------------------------------------------------------------------------------------
  497. // CBaseShape::ChangeFramePattern
  498. //----------------------------------------------------------------------------------------
  499.  
  500. void CBaseShape::ChangeFramePattern(Environment* ev, CDrawPart* part, const FW_PPattern& pattern)
  501. {
  502.     if (HasFrameStyle())
  503.     {
  504.         CheckPromise(ev, part);
  505.         
  506.         fFrameStyle = UnshareStyle(fFrameStyle);
  507.         fFrameStyle->SetPattern(pattern);
  508.     }
  509. }
  510.  
  511. //----------------------------------------------------------------------------------------
  512. // CBaseShape::ChangeFillColor
  513. //----------------------------------------------------------------------------------------
  514.  
  515. void CBaseShape::ChangeFillColor(Environment* ev, CDrawPart* part, const FW_CColor& color)
  516. {
  517.     if (HasFillStyle())
  518.     {
  519.         CheckPromise(ev, part);
  520.         
  521.         fFillInk = UnshareInk(fFillInk);
  522.         fFillInk->SetForeColor(color);
  523.     }
  524. }
  525.  
  526. //----------------------------------------------------------------------------------------
  527. // CBaseShape::ChangeFillPattern
  528. //----------------------------------------------------------------------------------------
  529.  
  530. void CBaseShape::ChangeFillPattern(Environment* ev, CDrawPart* part, const FW_PPattern& pattern)
  531. {
  532.     if (HasFillStyle())
  533.     {
  534.         CheckPromise(ev, part);
  535.         
  536.         fFillStyle = UnshareStyle(fFillStyle);
  537.         fFillStyle->SetPattern(pattern);
  538.     }
  539. }
  540.  
  541. //----------------------------------------------------------------------------------------
  542. // CBaseShape::ChangePenSize
  543. //----------------------------------------------------------------------------------------
  544.  
  545. void CBaseShape::ChangePenSize(Environment* ev, CDrawPart* part, FW_CFixed newPenSize)
  546. {
  547.     if (HasFrameStyle())
  548.     {
  549.         CheckPromise(ev, part);
  550.         
  551.         ClearCache();
  552.         
  553.         fFrameStyle = UnshareStyle(fFrameStyle);
  554.         fFrameStyle->SetPenSize(newPenSize);
  555.     }
  556. }
  557.  
  558. //----------------------------------------------------------------------------------------
  559. // CBaseShape::SetSubscribeLink
  560. //----------------------------------------------------------------------------------------
  561.  
  562. void CBaseShape::SetSubscribeLink(Environment* ev, CDrawSubscribeLink *subscribeLink)
  563. {
  564. FW_UNUSED(ev);
  565.  
  566.     fSubscribeLink = subscribeLink;
  567. }
  568.  
  569. //----------------------------------------------------------------------------------------
  570. // CBaseShape::SetPublishLink
  571. //----------------------------------------------------------------------------------------
  572.  
  573. void CBaseShape::SetPublishLink(Environment* ev, CDrawPublishLink *publishLink)
  574. {
  575. FW_UNUSED(ev);
  576.  
  577.     fPublishLink = publishLink;
  578. }
  579.  
  580. //----------------------------------------------------------------------------------------
  581. // CBaseShape::AdjustRectForPenSize
  582. //----------------------------------------------------------------------------------------
  583.  
  584. void CBaseShape::AdjustRectForPenSize(FW_CRect& rect, FW_CFixed penSize) const
  585. {
  586.     FW_CFixed half = penSize.Half();
  587.     rect.Inset(-half, -half);
  588. }
  589.  
  590. //----------------------------------------------------------------------------------------
  591. // CBaseShape::ChangeRenderVerb
  592. //----------------------------------------------------------------------------------------
  593.  
  594. void CBaseShape::ChangeRenderVerb(Environment* ev, CDrawPart* part, unsigned short renderVerb)
  595. {
  596.     CheckPromise(ev, part);
  597.     
  598.     ClearCache();
  599.     fRenderVerb = renderVerb;
  600. }
  601.  
  602. //----------------------------------------------------------------------------------------
  603. // CBaseShape::Read
  604. //----------------------------------------------------------------------------------------
  605.  
  606. void* CBaseShape::Read(FW_CReadableStream& archive)
  607. {
  608. FW_UNUSED(archive);
  609.     FW_DEBUG_MESSAGE("CBaseShape::Read should never be called");
  610.     return NULL;
  611. }
  612.  
  613. //----------------------------------------------------------------------------------------
  614. // CBaseShape::Write
  615. //----------------------------------------------------------------------------------------
  616.  
  617. void CBaseShape::Write(FW_CWritableStream& archive, const void* objectRep)
  618. {
  619.      ((CBaseShape*)objectRep)->Flatten(archive);
  620. }
  621.  
  622. //----------------------------------------------------------------------------------------
  623. // CBaseShape::GetUpdateBox
  624. //----------------------------------------------------------------------------------------
  625.  
  626. void CBaseShape::GetUpdateBox(Environment* ev, ODShape* updateBox) const
  627. {
  628.     FW_CRect bounds;
  629.     GetRectGeometry(bounds);    
  630.  
  631.     const FW_CFixed fxMargin = FW_IntToFixed(3);
  632.  
  633.     bounds.left        -= fxMargin;
  634.     bounds.top        -= fxMargin;
  635.     bounds.right    += fxMargin;
  636.     bounds.bottom    += fxMargin;
  637.  
  638.     ODRect odBounds = bounds;
  639.     updateBox->SetRectangle(ev, &odBounds);
  640. }
  641.  
  642. //----------------------------------------------------------------------------------------
  643. // CBaseShape::GetUpdateBox
  644. //----------------------------------------------------------------------------------------
  645.  
  646. void CBaseShape::GetUpdateBox(FW_CRect& updateBox) const
  647. {
  648.     GetRectGeometry(updateBox);
  649.  
  650.     const FW_CFixed fxMargin = FW_IntToFixed(3);
  651.  
  652.     updateBox.left        -= fxMargin;
  653.     updateBox.top        -= fxMargin;
  654.     updateBox.right        += fxMargin;
  655.     updateBox.bottom    += fxMargin;
  656. }
  657.  
  658. //----------------------------------------------------------------------------------------
  659. // CBaseShape::GetDragRect
  660. //----------------------------------------------------------------------------------------
  661.  
  662. void CBaseShape::GetDragRect(FW_CRect& dragRect) const
  663. {
  664.     GetRectGeometry(dragRect);
  665.     AdjustRectForPenSize(dragRect, GetPenSize());
  666. }
  667.  
  668. //----------------------------------------------------------------------------------------
  669. // CBaseShape::GetResizeStyle
  670. //----------------------------------------------------------------------------------------
  671.  
  672. FW_PStyle CBaseShape::GetResizeStyle() const
  673. {
  674.     FW_PStyle resizeStyle(GetPenSize(), FW_kGrayPat);
  675.     return resizeStyle;
  676. }
  677.  
  678. //----------------------------------------------------------------------------------------
  679. // CBaseShape::SubtractToWindowClip
  680. //----------------------------------------------------------------------------------------
  681. //    ATTENTION: windowClip is in Window coordinates. tempShape is just a working shape. It is
  682. //    allocated by CDrawFrame::ClipEmbeddedFacets so I don't have to allocate one everytime.
  683.  
  684. void CBaseShape::SubtractToWindowClip(Environment *ev, 
  685.                                         CDrawFacetClipper* facetClipper, 
  686.                                         ODFacet* containingFacet, 
  687.                                         ODShape* windowClip, 
  688.                                         ODShape* tempShape)
  689. {
  690. FW_UNUSED(facetClipper);
  691.  
  692.     GetClipRegion(ev, tempShape);
  693.     FW_CAcquiredODTransform aqWindowContentTransform = containingFacet->AcquireWindowContentTransform(ev, NULL);
  694.     tempShape->Transform(ev, aqWindowContentTransform);        // in window coordinate
  695.     windowClip->Subtract(ev, tempShape);
  696. }
  697.  
  698. //----------------------------------------------------------------------------------------
  699. // CBaseShape::WhichHandle
  700. //----------------------------------------------------------------------------------------
  701.  
  702. short CBaseShape::WhichHandle(FW_CGraphicContext& gc, const FW_CPoint& mouse) const
  703. {
  704.     for (short i=1; i<=fNumberOfHandles; i++)
  705.     {
  706.         CalcHandle(i, CBaseShape::gWorkingHandle);
  707.         if (CBaseShape::gWorkingHandle->HitTest(gc, mouse, FW_IntToFixed(0)))
  708.             return i;
  709.     }
  710.         
  711.     return 0;
  712. }
  713.  
  714.